package com.project.controller;

import com.project.bean.LinkBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController //@Controller和@ResponseBody的结合体
@RequestMapping("my")
public class MyTestController {

    @RequestMapping("getLink")
//    @ResponseBody //响应体（会把对象变成json格式打印到客户端。日期要在bean类里面加格式注解）
    public LinkBean getLink(){

        return new LinkBean("张三", LocalDate.parse("2002-01-12"),"1345667784");
    }

    @RequestMapping("getString")
//    @ResponseBody //会直接返回字符串的内容 //返回 添加
    public String getString(){
        return "<a href='/add'>添加</a>";
    }
}
